package leetcode.code1109;

public class Solution extends Solution1109 {

	@Override
	public int[] corpFlightBookings(int[][] bookings, int n) {
		int[] result = new int[n];
		int len = bookings.length;
		// [[1,2,10],[2,3,20],[2,5,25]]
		for (int i = 0; i < len; i++) {
			result[bookings[i][0] - 1] += bookings[i][2];
			if (bookings[i][1] < n)
				result[bookings[i][1]] -= bookings[i][2];
		}
		for (int i = 1; i < n; i++) {
			result[i] += result[i - 1];
		}
		return result;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
	}

}
